<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
           
    /*
    *yuexin performance 
    * @func 计算工资
    *@params monthSalary 月薪 数值类型为number
    *   level  [S A B C D] 
    * @return  total number 总工资 
    * 
    */
        function calculateSalory(monthSalary,level = 'C'){
            switch(level){
                case 'SSP':
                     return performanceSSP(monthSalary);
                     break;
                case 'S':
                     return performanceS(monthSalary);
                     break;
                case 'A':
                     return performanceA(monthSalary);
                     break;
                case 'B':
                     return  performanceB(monthSalary);
                     break;
                case 'C':
                     return  performanceC(monthSalary);
                     break;
                case 'D':
                     return  performanceD(monthSalary);
                     break;
            }
        }
        //财务执行
        //解耦等级的工资制定
        //SSP等级
        const performanceSSP = function(salary){
            return salary * (12+12)
        }
         //S等级
         const performanceS = function(salary){
            return salary * (12+8)
        }
        //A等级
        const performanceA = function(salary){
            return salary * (12+4)
        }
        //B等级
        const performanceB = function(salary){
            return salary * (12+3)
        }
        //C
        const performanceC = function(salary){
            return salary * (12+2)
        }
        //D
        const performanceD = function(salary){
            return salary * (12+1)
        }
        let total = calculateSalory(20000,'S');
        let anotherTotal = calculateSalory(7000);
        let mostTotal = calculateSalory(26000,'SSP')
        console.log(total,anotherTotal,mostTotal);
    </script>
</body>
</html>